<?php
// td1

function getCols($tbl1, $sql) {
	$tbl1 = "INTO " . $tbl1;
$vals = explode($tbl1, $sql);
$vals = explode("VALUES", $vals[1]);
$cols = explode(",", $vals[0]);

$vals = explode(",", $vals[1]);

$cnt = count($cols);
if($cnt != count($vals)) {
	$td1 = 'count cols != count count vals';
} else {
 for ($i = 0; $i < $cnt; $i++) {
	$td1 = $td1 . "$cols[$i]: $vals[$i]<br>";
  }
}

return $td1;

}

$sql = "
INSERT INTO image (link_url,link_url_any,link_url_carrier1,link_url_carrier2,link_url_carrier3,name,status,buyer_id,buyer_type,terminal_type,regist_date) VALUES ('http:://localhost/eclipse/admage/dkeisokucommonlink1.html',NULL,'','','','d-keisoku common link 1',1,73,2,9,now())
";
$tbl1 = "image";
$td1 = getCols($tbl1, $sql);

$sql = "
INSERT INTO link (name,image_id,status,rate,initial_rate,priority,article_id,buyer_id,buyer_type,seller_id,site_id,campaign_id,regist_date,link_no) VALUES ('d-keisoku common link 1',1373690,1,100,100,0,1021,73,2,73,372,0,now(),1)
";
$tbl2 = "link";
$td2 = getCols($tbl2, $sql);

echo "<table border='0'>";
	echo "<tr>";
		echo "<td  style='padding-left: 20'>";
			echo "<b>$tbl1</b><br>";
			echo $td1;
		echo "</td>";
		echo "<td style='padding-left: 20'>";
			echo "<b>$tbl2</b><br>";
			echo $td2;
		echo "</td>";

	echo "</tr>";
echo "</table>";



